package com.nantong.common.core.enums.commonEnums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 销售订单状态枚举
 */
@Getter
@AllArgsConstructor
public enum SalesOrderStatusEnum {

    /**
     * 完结
     */
    COMPLETED(1, "完结"),

    /**
     * 退款
     */
    REFUNDED(2, "退款");

    /**
     * 状态码
     */
    private final Integer code;

    /**
     * 状态描述
     */
    private final String desc;

    /**
     * 根据状态码获取状态描述
     */
    public static String getDescByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (SalesOrderStatusEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum.getDesc();
            }
        }
        return null;
    }

}

